<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
  <head>
      <title>SWF upload 上传文件示例</title>
 	  <script type="text/javascript" src="<%=basePath%>swfupload/swfupload.js"></script>
	  <script type="text/javascript" src="<%=basePath%>js/fileprogress.js"></script>
	  <script type="text/javascript" src="<%=basePath%>js/handlers.js"></script>
	  <script type="text/javascript" src="<%=basePath%>js/swfupload.queue.js"></script>
	  <script type="text/javascript" src="<%=basePath%>js/swfupload.swfobject.js"></script>
	  <link rel="stylesheet" href="css/default.css" type="text/css"></link>
  

  
 <script type="text/javascript">
   var swfu;
   window.onload = function() {
	    var settings = {
	    flash_url : "js/swfupload.swf",  // 调用的上传的flash控件
	    upload_url: "${pageContext.request.contextPath}/servlet/UploadFileServlet",     //  后台调用的文件处理程序 注意：配置不正确的话，易导致404错误
	    file_size_limit : "1024 MB",       //  所选文件的最大值
	    file_types : "*.*",                     //  限定所上传文件的类型
	    file_types_description : "All Files",
	    file_upload_limit : 100,            //  设置所上传文件最大个数
	    file_queue_limit : 0,                 //  设置上传列表中的最大个数 0：不限制
	    custom_settings : {                 //  用户自定义设置
	     progressTarget : "fsUploadProgress",
	     uploadButtonId : "btnUpload",
	     cancelButtonId : "btnCancel"
	    },
	    debug: false,
	    auto_upload:false,                  //  设置自动上传为false
	 
	    // Button settings   按钮的设置
	    button_image_url: "images/TestImageNoText_65x29.png",
	    button_width: "60",
	    button_height: "30",
	    button_placeholder_id: "spanButtonPlaceHolder",
	    button_text: '<span class="theFont">选择</span>',
	    button_text_style: ".theFont { font-size: 14; }",
	    button_text_left_padding: 15,
	    button_text_top_padding: 3,
	    
	    // The event handler functions are defined in handlers.js  事件的处理函数定义在handlers.js中
	    file_queued_handler : fileQueued,
	    file_queue_error_handler : fileQueueError,
	    file_dialog_complete_handler : fileDialogComplete,
	    upload_start_handler : uploadStart,
	    upload_progress_handler : uploadProgress,
	    upload_error_handler : uploadError,
	    upload_success_handler : uploadSuccess,
	    upload_complete_handler : uploadComplete,
	    queue_complete_handler : queueComplete // Queue plugin event
	   };
	   swfu = new SWFUpload(settings);
};
 
</script>
</head>
<body>
    <div class="wrap" id="content">
     <div class="content">
     <div class="fieldset flash" id="fsUploadProgress">
      <p>
       <span class="legend">上传列表</span>
      </p>
     </div>
     <div id="divStatus" class="num">
      0 个文件上传
     </div>
     <div style="margin-left: 30px;">
      <span id="spanButtonPlaceHolder"></span>
      <div style="margin-top: -20px; margin-left: 60px;">
      
      <input id="btnUpload" type="button" value="上 传"
         onclick="swfu.startUpload();"
         style="margin-left: 20px; margin-bottom: 10px" class="Btn" />
         
       <input id="btnCancel" type="button" height="29" value="取消上传"
        onclick="swfu.cancelQueue();"
        style="margin-left: 20px; margin-bottom: 10px" />
      </div>
     </div>
    </div>
   </div> 
  </body>
